

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>iSCSI Initiator for Linux &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="iSCSI Initiator for Microsoft Windows" href="../iscsi-initiator-win/" />
    <link rel="prev" title="iSCSI Initiators 的配置" href="../iscsi-initiators/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 块设备</a> &raquo;</li>
        
          <li><a href="../rbd-integrations/">Ceph 块设备与第三方对接</a> &raquo;</li>
        
          <li><a href="../iscsi-overview/">Ceph iSCSI Gateway</a> &raquo;</li>
        
          <li><a href="../iscsi-initiators/">iSCSI Initiators 的配置</a> &raquo;</li>
        
      <li>iSCSI Initiator for Linux</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/rbd/iscsi-initiator-linux.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 块设备</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../rados-rbd-cmds/">基本命令</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rbd-operations/">运维</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../rbd-integrations/">对接</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../rbd-ko/">内核模块</a></li>
<li class="toctree-l3"><a class="reference internal" href="../qemu-rbd/">QEMU</a></li>
<li class="toctree-l3"><a class="reference internal" href="../libvirt/">libvirt</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-kubernetes/">Kubernetes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-nomad/">Nomad</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-openstack/">OpenStack</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-cloudstack/">CloudStack</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../iscsi-overview/">LIO iSCSI Gateway</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../iscsi-requirements/">Requirements</a></li>
<li class="toctree-l4"><a class="reference internal" href="../iscsi-targets/">Configuring the iSCSI Target</a></li>
<li class="toctree-l4 current"><a class="reference internal" href="../iscsi-initiators/">Configuring the iSCSI Initiators</a></li>
<li class="toctree-l4"><a class="reference internal" href="../iscsi-monitoring/">Monitoring the iSCSI Gateways</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-windows/">Windows</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../man/">手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="iscsi-initiator-for-linux">
<h1>iSCSI Initiator for Linux<a class="headerlink" href="#iscsi-initiator-for-linux" title="Permalink to this headline">¶</a></h1>
<p><strong>Prerequisite:</strong></p>
<ul class="simple">
<li><p>Package <code class="docutils literal notranslate"><span class="pre">iscsi-initiator-utils</span></code></p></li>
<li><p>Package <code class="docutils literal notranslate"><span class="pre">device-mapper-multipath</span></code></p></li>
</ul>
<p><strong>Installing:</strong></p>
<p>Install the iSCSI initiator and multipath tools:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># yum install iscsi-initiator-utils</span>
<span class="c1"># yum install device-mapper-multipath</span>
</pre></div>
</div>
</div></blockquote>
<p><strong>Configuring:</strong></p>
<ol class="arabic">
<li><p>Create the default <code class="docutils literal notranslate"><span class="pre">/etc/multipath.conf</span></code> file and enable the
<code class="docutils literal notranslate"><span class="pre">multipathd</span></code> service:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># mpathconf --enable --with_multipathd y</span>
</pre></div>
</div>
</li>
<li><p>Add the following to <code class="docutils literal notranslate"><span class="pre">/etc/multipath.conf</span></code> file:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">devices</span> <span class="p">{</span>
        <span class="n">device</span> <span class="p">{</span>
                <span class="n">vendor</span>                 <span class="s2">&quot;LIO-ORG&quot;</span>
                <span class="n">product</span>                <span class="s2">&quot;TCMU device&quot;</span>
                <span class="n">hardware_handler</span>       <span class="s2">&quot;1 alua&quot;</span>
                <span class="n">path_grouping_policy</span>   <span class="s2">&quot;failover&quot;</span>
                <span class="n">path_selector</span>          <span class="s2">&quot;queue-length 0&quot;</span>
                <span class="n">failback</span>               <span class="mi">60</span>
                <span class="n">path_checker</span>           <span class="n">tur</span>
                <span class="n">prio</span>                   <span class="n">alua</span>
                <span class="n">prio_args</span>              <span class="n">exclusive_pref_bit</span>
                <span class="n">fast_io_fail_tmo</span>       <span class="mi">25</span>
                <span class="n">no_path_retry</span>          <span class="n">queue</span>
        <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</li>
<li><p>Restart the <code class="docutils literal notranslate"><span class="pre">multipathd</span></code> service:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># systemctl reload multipathd</span>
</pre></div>
</div>
</li>
</ol>
<p><strong>iSCSI Discovery and Setup:</strong></p>
<ol class="arabic">
<li><p>If CHAP was setup on the iSCSI gateway, provide a CHAP username and
password by updating the <code class="docutils literal notranslate"><span class="pre">/etc/iscsi/iscsid.conf</span></code> file accordingly.</p></li>
<li><p>Discover the target portals:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># iscsiadm -m discovery -t st -p 192.168.56.101</span>
<span class="mf">192.168.56.101</span><span class="p">:</span><span class="mi">3260</span><span class="p">,</span><span class="mi">1</span> <span class="n">iqn</span><span class="mf">.2003</span><span class="o">-</span><span class="mf">01.</span><span class="n">org</span><span class="o">.</span><span class="n">linux</span><span class="o">-</span><span class="n">iscsi</span><span class="o">.</span><span class="n">rheln1</span>
<span class="mf">192.168.56.102</span><span class="p">:</span><span class="mi">3260</span><span class="p">,</span><span class="mi">2</span> <span class="n">iqn</span><span class="mf">.2003</span><span class="o">-</span><span class="mf">01.</span><span class="n">org</span><span class="o">.</span><span class="n">linux</span><span class="o">-</span><span class="n">iscsi</span><span class="o">.</span><span class="n">rheln1</span>
</pre></div>
</div>
</li>
<li><p>Login to target:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># iscsiadm -m node -T iqn.2003-01.org.linux-iscsi.rheln1 -l</span>
</pre></div>
</div>
</li>
</ol>
<p><strong>Multipath IO Setup:</strong></p>
<p>The multipath daemon (<code class="docutils literal notranslate"><span class="pre">multipathd</span></code>), will set up devices automatically
based on the <code class="docutils literal notranslate"><span class="pre">multipath.conf</span></code> settings. Running the <code class="docutils literal notranslate"><span class="pre">multipath</span></code>
command show devices setup in a failover configuration with a priority
group for each path.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># multipath -ll
mpathbt (360014059ca317516a69465c883a29603) dm-1 LIO-ORG ,IBLOCK
size=1.0G features=&#39;0&#39; hwhandler=&#39;1 alua&#39; wp=rw
|-+- policy=&#39;queue-length 0&#39; prio=50 status=active
| `- 28:0:0:1 sde  8:64  active ready running
`-+- policy=&#39;queue-length 0&#39; prio=10 status=enabled
  `- 29:0:0:1 sdc  8:32  active ready running
</pre></div>
</div>
<p>You should now be able to use the RBD image like you would a normal
multipath’d iSCSI disk.</p>
<ol class="arabic" start="4">
<li><p>Logout from target:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># iscsiadm -m node -T iqn.2003-01.org.linux-iscsi.rheln1 -u</span>
</pre></div>
</div>
</li>
</ol>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../iscsi-initiator-win/" class="btn btn-neutral float-right" title="iSCSI Initiator for Microsoft Windows" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../iscsi-initiators/" class="btn btn-neutral float-left" title="iSCSI Initiators 的配置" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>